#!user/bin/env python3
# -- coding: utf-8 --
# @Createtime：2023/9/8 15:34
# @Updatetime：15:34
# @Author：Test008
# @File：3-类和对象
# @Description：

"""
设计一个闹钟类，属性是ID和price，方法是响铃
"""


# class Clock(object):
#     id = None
#     price = None
#
#     def ring(self):
#         import winsound
#         winsound.Beep(2000, 3000)
#
#
# clock1 = Clock()
# clock1.id = "0030032"
# clock1.price = "19.9元"
# print(f"我是产品{clock1.id},我的价格是{clock1.price}")
# clock1.ring()
#
# clock2 = Clock()
# clock2.id = "0030033"
# clock2.price = "18.80元"
# print(f"我是产品{clock2.id},我的价格是{clock2.price}")
# clock1.ring()

class Clock():
    id = None
    price = None

    def ring(self):
        import winsound
        print(f"编号：{self.id},价格：{self.price}")
        winsound.Beep(2000, 1000)  # 响铃频率和时间


clock1 = Clock()
clock1.id = "003032"
clock1.price = "12.99"
clock1.ring()

clock2 = Clock()
clock2.id = "003033"
clock2.price = "13.99"
clock2.ring()

clock3 = Clock()
clock3.id = "003034"
clock3.price = "14.99"
clock3.ring()

clock4 = Clock()
clock4.id = "003035"
clock4.price = "14.99"
clock4.ring()

clock5 = Clock()
clock5.id = "003036"
clock5.price = "16.99"
clock5.ring()
